﻿<ResourceDictionary x:Class="Bellucci.Resources"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:con="http://schemas.kent.boogaart.com/converters"
	xmlns:sys="clr-namespace:System;assembly=mscorlib">
	
	<Style TargetType="Menu">
		<Setter Property="Background" Value="#302010AA"/>
	</Style>

	<Style TargetType="Button">
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="Margin" Value="3"/>
		<Setter Property="MinWidth" Value="80"/>
		<Setter Property="MinHeight" Value="25"/>
		<Setter Property="Foreground" Value="White"/>
		<Setter Property="FontWeight" Value="Bold"/>
		<Setter Property="HorizontalContentAlignment" Value="Center"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Background">
			<Setter.Value>
				<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
					<GradientStop Color="#5C6660" Offset="0"/>
					<GradientStop Color="#5C6660" Offset="0.5"/>
					<GradientStop Color="#B2BCB7" Offset="0.5"/>
					<GradientStop Color="#596A60" Offset="0.9"/>
					<GradientStop Color="#374F40" Offset="0.9"/>
					<GradientStop Color="#2C4436" Offset="1"/>
				</LinearGradientBrush>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ButtonBase">
					<Border Background="{TemplateBinding Panel.Background}" BorderBrush="{TemplateBinding Border.BorderBrush}" SnapsToDevicePixels="True">
						<ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter Property="Background" Value="#C62B33"/>
				<Setter Property="Foreground" Value="Black"/>
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style x:Key="PluginsItemsControlStyle" TargetType="{x:Type ItemsControl}">
		<Setter Property="ItemTemplateSelector" Value="{StaticResource PluginItemTemplateSelector}"/>
	</Style>

	<StackPanel x:Key="PluginsItemsControlHeaderContent" x:Shared="False" Background="#50000080">
		<StackPanel.Resources>
			<con:MapConverter x:Key="PluginGroupDescriptionConverter">
				<con:Mapping To="These plugins are always loaded:">
					<con:Mapping.From>
						<sys:Boolean>True</sys:Boolean>
					</con:Mapping.From>
				</con:Mapping>
				<con:Mapping To="You must toggle these plugins to green in order for them to be loaded:">
					<con:Mapping.From>
						<sys:Boolean>False</sys:Boolean>
					</con:Mapping.From>
				</con:Mapping>
			</con:MapConverter>
		</StackPanel.Resources>

		<StackPanel Margin="3">
			<ContentControl>
				<Bold>
					<TextBlock FontSize="13" Margin="5 0 0 0" Text="{Binding Name, Converter={StaticResource PluginGroupDescriptionConverter}}"/></Bold>
			</ContentControl>
		</StackPanel>
	</StackPanel>

	<DataTemplate x:Key="TrustedPluginDataTemplate">
		<Border BorderBrush="Gray" BorderThickness="1" Margin="7" Padding="3" CornerRadius="3" Background="#50008000">
			<Grid>
				<Grid.Resources>
					<Style TargetType="TextBlock">
						<Setter Property="Margin" Value="2 1 2 1"/>
						<Setter Property="FontSize" Value="10"/>
					</Style>
				</Grid.Resources>

				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="10"/>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="Auto"/>
				</Grid.ColumnDefinitions>

				<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>

					<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Bold"/>
					<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Version}" FontSize="12"/>
				</Grid>

				<Border Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="Black" BorderThickness="1"/>

				<TextBlock Grid.Row="2" Grid.Column="1">Description:</TextBlock>
				<TextBlock Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Text="{Binding Description}" TextTrimming="CharacterEllipsis"/>

				<TextBlock Grid.Row="3" Grid.Column="1">Path:</TextBlock>
				<TextBlock Grid.Row="3" Grid.Column="2" Text="{Binding Path}" TextTrimming="CharacterEllipsis"/>
				<TextBlock Grid.Row="3" Grid.Column="3">
					<Hyperlink Tag="{Binding Path}" Click="_explore_Click">Explore</Hyperlink>
				</TextBlock>

				<TextBlock Grid.Row="4" Grid.Column="1">Status:</TextBlock>
				<TextBlock Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" TextTrimming="CharacterEllipsis">
					<TextBlock.Text>
						<Binding Path="ModuleStatus" Converter="{StaticResource ModuleStatusConverter}"/>
					</TextBlock.Text>
				</TextBlock>
			</Grid>
		</Border>
	</DataTemplate>
	
	<DataTemplate x:Key="UntrustedPluginDataTemplate">
		<ToggleButton IsChecked="{Binding IsWhitelisted}">
			<ToggleButton.Template>
				<ControlTemplate>
					<Grid x:Name="_grid" Margin="7">
						<Border x:Name="_border" BorderBrush="Gray" BorderThickness="1" Padding="3" CornerRadius="3" Background="#50800000">
							<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"/>
						</Border>
					</Grid>
					<ControlTemplate.Triggers>
						<DataTrigger Binding="{Binding IsWhitelisted}" Value="True">
							<Setter TargetName="_border" Property="Background" Value="#50008000"/>
						</DataTrigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="_grid" Property="Background" Value="#30303030"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</ToggleButton.Template>
			<Grid>
				<Grid.Resources>
					<Style TargetType="TextBlock">
						<Setter Property="Margin" Value="2 1 2 1"/>
						<Setter Property="FontSize" Value="10"/>
					</Style>
				</Grid.Resources>
				
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="10"/>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="Auto"/>
				</Grid.ColumnDefinitions>

				<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					
					<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Bold"/>
					<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Version}" FontSize="12"/>
				</Grid>
				
				<Border Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="Black" BorderThickness="1"/>
				
				<TextBlock Grid.Row="2" Grid.Column="1">Description:</TextBlock>
				<TextBlock Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Text="{Binding Description}" TextTrimming="CharacterEllipsis"/>

				<TextBlock Grid.Row="3" Grid.Column="1">Path:</TextBlock>
				<TextBlock Grid.Row="3" Grid.Column="2" Text="{Binding Path}" TextTrimming="CharacterEllipsis"/>
				<TextBlock Grid.Row="3" Grid.Column="3">
					<Hyperlink Tag="{Binding Path}" Click="_explore_Click">Explore</Hyperlink>
				</TextBlock>

				<TextBlock Grid.Row="4" Grid.Column="1">Status:</TextBlock>
				<TextBlock Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" TextTrimming="CharacterEllipsis">
					<TextBlock.Text>
						<Binding Path="ModuleStatus" Converter="{StaticResource ModuleStatusConverter}"/>
					</TextBlock.Text>
				</TextBlock>
			</Grid>
		</ToggleButton>
	</DataTemplate>

	<DataTemplate x:Key="ShortcutTemplate">
		<Button Command="{Binding Command.WpfCommand}" HorizontalAlignment="Left">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="25"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="Auto"/>
				</Grid.ColumnDefinitions>

				<Image Source="{Binding Command.Image}" Width="Auto" Height="Auto"/>
				<TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Command.Text}"/>
			</Grid>
		</Button>
	</DataTemplate>
</ResourceDictionary>